Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Optional Chaining #891

Merged
merged 1 commit into from
Jun 11, 2020
Merged

Conversation

mysticatea
Copy link
Contributor

This PR adds a new syntax Optional Chaining (?. operator).

Language Spec: tc39/ecma262#1646
ESTree Spec: estree/estree#204

Please mind the ESTree spec is on discussing. It might changes.

Also, this PR adds a parameter to the parseSubscript method. The parameter is used to make shortCircuited property. Therefore, if a plugin doesn't pass the new parameter, acorn cannot make shortCircuited property properly (it become always false).

@staeke
Copy link

staeke commented Feb 15, 2020

can this be merged? why the wait?

@franktopel
Copy link

We're also waiting for this so we can use this feature with webpack and without Babel.

@larryosborn
Copy link

Could this and #890 please be merged? 🙏 It would open up these new language features to the many modules downstream that depend on acorn. It would also brighten up my day-to-day work by being able to use these two operators. It looks like many other people are excited too!

@marijnh
Copy link
Member

marijnh commented Apr 8, 2020

@mysticatea @nzakas Is there any hope for an ESTree consensus for this on the short run?

@nzakas
Copy link
Contributor

nzakas commented Apr 9, 2020

I’ll see if I can push it forward.

@the-phoenix
Copy link

@nzakas Any updates do we have? You're about to merge this, right?
Or we can't merge this because of the conflicts here?
(FYI @mysticatea )

@marijnh
Copy link
Member

marijnh commented Apr 12, 2020

Don't post further impatient queries, or I'm locking this. We're waiting on the ESTree format to stabilize, and this'll be able to get merged as soon as that happens.

@RReverser
Copy link
Member

@mysticatea @nzakas Is there any hope for an ESTree consensus for this on the short run?

We have some better idea of what we want, but there are some final details to discuss.

@fadamakis

This comment has been minimized.

@sanex3339

This comment has been minimized.

@RReverser
Copy link
Member

No, if there were, they would be posted here. Please refrain from spamming the thread.

@mysticatea
Copy link
Contributor Author

I updated this PR for the approved version of ESTree spec.

@marijnh marijnh merged commit 4adea30 into acornjs:master Jun 11, 2020
@marijnh
Copy link
Member

marijnh commented Jun 11, 2020

Wonderful! Merged and released as 7.3.0

@illeatmyhat
Copy link

Is it possible to backport this to v6 so that the feature is supported in webpack v4?

@RReverser
Copy link
Member

@illeatmyhat Can Webpack upgrade to Acorn 7? There are very few breaking change, and they mainly relate to plugin APIs, most of which have already upgraded.

@dosentmatter
Copy link

Wonderful! Merged and released as 7.3.0

@marijnh is there a typo in CHANGELOG.md? For 7.1.0, it says

7.1.0 (2020-06-11)
Add support for optional chaining (?.) and nullish coalescing (??).

However,

  • this MR was merged on 2020-06-11T07:29:38Z
  • 7.3.0 was released on 2020-06-11T07:54:17.900Z
  • 7.1.0 was released 2019-09-24T06:34:22.464Z

@marijnh
Copy link
Member

marijnh commented Feb 24, 2021

You appear to be looking at the changelog for acorn-loose, not acorn.

kevinkrpicak added a commit to kevinkrpicak/amd-to-es6 that referenced this pull request Jan 25, 2022
Support for optional chaining becomes available on version 7.3.0 acornjs/acorn#891
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.